<?php

/**
 * Evenement filter form base class.
 *
 * @package    tfe
 * @subpackage filter
 * @author     3emeIG
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseEvenementFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'libelle'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'date'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'heure_de_debut'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'heure_de_fin'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prix_reservation' => new sfWidgetFormFilterInput(),
      'prix_sur_place'   => new sfWidgetFormFilterInput(),
      'prix_jeunes'      => new sfWidgetFormFilterInput(),
      'prix_membres'     => new sfWidgetFormFilterInput(),
      'lieu'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lieu'), 'add_empty' => true)),
      'commentaire'      => new sfWidgetFormFilterInput(),
      'type'             => new sfWidgetFormFilterInput(),
      'id_spectacle'     => new sfWidgetFormFilterInput(),
      'id_atelier'       => new sfWidgetFormFilterInput(),
      'id_stage'         => new sfWidgetFormFilterInput(),
      'id_location'      => new sfWidgetFormFilterInput(),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'libelle'          => new sfValidatorPass(array('required' => false)),
      'date'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'heure_de_debut'   => new sfValidatorPass(array('required' => false)),
      'heure_de_fin'     => new sfValidatorPass(array('required' => false)),
      'prix_reservation' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prix_sur_place'   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prix_jeunes'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prix_membres'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'lieu'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Lieu'), 'column' => 'id')),
      'commentaire'      => new sfValidatorPass(array('required' => false)),
      'type'             => new sfValidatorPass(array('required' => false)),
      'id_spectacle'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_atelier'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_stage'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_location'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('evenement_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Evenement';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'libelle'          => 'Text',
      'date'             => 'Date',
      'heure_de_debut'   => 'Text',
      'heure_de_fin'     => 'Text',
      'prix_reservation' => 'Number',
      'prix_sur_place'   => 'Number',
      'prix_jeunes'      => 'Number',
      'prix_membres'     => 'Number',
      'lieu'             => 'ForeignKey',
      'commentaire'      => 'Text',
      'type'             => 'Text',
      'id_spectacle'     => 'Number',
      'id_atelier'       => 'Number',
      'id_stage'         => 'Number',
      'id_location'      => 'Number',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
    );
  }
}
